import { defineStore } from 'pinia';

interface Template {
    id: string;
    name: string;
    description: string;
    preview_image: string;
}

interface Category {
    code: string;
    name: string;
}

interface TemplateState {
    currentTemplate: Template | null;
    categories: Category[];
    templates: Record<string, Template[]>;
}

export const useTemplateStore = defineStore('template', {
    state: (): TemplateState => ({
        currentTemplate: null,
        categories: [
            { code: 'text2img', name: '文生图' },
            { code: 'img2img', name: '图生图' }
        ],
        templates: {
            text2img: [],
            img2img: []
        }
    }),

    getters: {
        getTemplatesByCategory: (state) => state.templates
    },

    actions: {
        setCurrentTemplate(template: Template) {
            this.currentTemplate = template;
        }
    }
}); 